home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DDJMAG / DDJ9207.ZIP / AVKCAPT.ZIP / AVKCAPT.H < prev    next >
C/C++ Source or Header  |  1992-03-11  |  6KB  |  196 lines

  1. //-------------------------------------------------------------------------
  2. //            ActionMedia II Programmer's Toolkit
  3. //    
  4. //            Windows Motion Player Sample Program
  5. //    
  6. // Header Name:    avkcapt.h
  7. //
  8. // Description:    header file for avkcapt.exe
  9. //    
  10. //    Copyright Intel Corp. 1991, 1992
  11. //    All Rights Reserved.
  12. //                
  13. //-------------------------------------------------------------------------
  14.  
  15. #ifndef AVKCAPT_H
  16. #define    AVKCAPT_H    1
  17.  
  18. #include "avkapi.h"
  19.  
  20. //    File name for the RTV 2.0 VSH data file (from avkalg.h)
  21.  
  22. #define    VSHFILE_NAME    AVK_RTV_20_ENCODE_DATA_NAME
  23.  
  24. //    A couple of shorthand AVK #defines for convenience.
  25.  
  26. #define    OK            AVK_ERR_OK
  27. #define    NOW            AVK_TIME_IMMEDIATE
  28. #define    HNULL        ((HAVK)0)
  29.  
  30. //    Menu option ID values.
  31.  
  32. #define    IDM_OPEN        100
  33. #define    IDM_CLOSE        101
  34. #define    IDM_ABOUT        102
  35. #define    IDM_TIMER        103
  36. #define    IDM_MONITOR        200
  37. #define    IDM_CAPTURE        300
  38. #define    IDM_SYNC        400
  39. #define    IDM_EXIT        500
  40.  
  41. //    ID for the file name edit box.
  42.  
  43. #define    IDD_FNAME        100
  44.  
  45. //     ID's for the Sync dialog box.
  46.  
  47. #define IDD_SYNC_NTSC    101
  48. #define    IDD_SYNC_PAL    102
  49.  
  50. //    Values for EnableMenuItem() flags.
  51.  
  52. #define    MENUITEM_ON        MF_ENABLED
  53. #define    MENUITEM_OFF    (MF_DISABLED | MF_GRAYED)
  54.  
  55. //    Values for capturing.
  56.  
  57. #define AUD_SAMPLE_RATE        (U32)33075
  58. #define    FRAME_RATE            (U32)33367
  59.  
  60. //    Size and granularity of video Group Buffer and audio Group Buffer.  
  61. //    The granularity is the amount of data in the buffer that will trigger
  62. //    an AVK_CAPTURE_DATA_AVAILABLE message from AVK telling us to retrieve
  63. //    some data.  Unlike in playback, we want to set the granularity low
  64. //    when capturing so we have plenty of extra buffer space to capture into
  65. //    while we are retrieving the data.
  66.  
  67. #define    VID_BUF_SIZE        (256L * 1024L)    
  68. #define    VID_BUF_GRAN        ( 64L * 1024L)        
  69.  
  70. #define    AUD_BUF_SIZE        (128L * 1024L)        
  71. #define    AUD_BUF_GRAN        ( 16L * 1024L)
  72.  
  73. //    Size of host buffers for reading captured frames from the Group Buffers.
  74. //    These can be altered to tune capture performance.
  75.  
  76. #define    HOST_BUF_SIZE        32768U
  77.  
  78. //    Maximum number of iterations of the capture loop before we are forced
  79. //    back to the main message loop.  This can be altered to tune capture
  80. //    performance.
  81.  
  82. #define    CAPTURE_LOOPS        10
  83.  
  84. //    ID value for the capture Windows timer.
  85.  
  86. #define    TIMER_ID        1
  87.  
  88. //    Number of milliseconds between timer ticks.  This can be altered to
  89. //    tune capture performance.
  90.  
  91. #define    TIMER_INTERVAL    500
  92.  
  93. //    ID value for the clipping timer.
  94.  
  95. #define CLIP_TIMER_ID        2
  96.  
  97. #define    CLIP_TIMER_INTERVAL    500
  98.  
  99. //    States for the capture engine.
  100.  
  101. #define    ST_UNINITIALIZED        0
  102. #define    ST_INITIALIZED            1
  103. #define    ST_MONITORING            2
  104. #define    ST_CAPTURING            3
  105.  
  106. //    Control structure for the current view.
  107.  
  108. typedef struct tagVIEW {
  109.     HAVK    hView;                // AVK View handle
  110.     HAVK    hConnDigi2Strm;        // Digitizer -> Video Stream connector handle
  111.     HAVK    hConnStrm2View;        // Video Stream -> View connector handle
  112.     BOOL    bConnEnabled;        // TRUE if the connector is enabled
  113.     WORD    DviMonitorSync;        // DviMonitorSync value from AVK.INI
  114.     I16        cxView;                // View's x resolution
  115.     I16        cyView;                // View's y resolution
  116.     double    xDelta;                // used to convert screen x coords to view
  117.     double    yDelta;                // used to convert screen y coords to view
  118.     I16        cxScreen;            // physical screen's x resolution
  119.     I16        cyScreen;            // physical screen's y resolution
  120.     U16        VidType;            // View's video type
  121.     U16        BmFmt;                // View's bitmap format
  122.     BOOL    bIsKeyed;            // TRUE if the View is keyed
  123.     BOX        SrcBox;                // connector's source rectangle
  124.     BOX        DstBox;                // connector's destination rectangle
  125. } VIEW;        
  126.  
  127.  
  128. typedef struct tagCAPT {
  129.     HAVK        hGrpBuf;            // group buffer handle
  130.     HAVK        hStrm;                // stream handle
  131.     char far   *pBufHead;            // host RAM I/O buffer
  132.     char far   *pBufCurr;            // current position in host RAM I/O buffer
  133.     U32            BufDataCnt;            // amount of data in host RAM I/O buffer
  134. } CAPT;
  135.  
  136.  
  137. //-------------------------------------------------------------------------
  138. //    Structure for storing sync resolutions. The sync table will be an
  139. //    array of VIDEO_SYNC structures called Syncs[].
  140. //-------------------------------------------------------------------------
  141.  
  142. typedef struct tagVIDEO_SYNC {
  143.     WORD    xResRTV;            // RTV capture x resolution
  144.     WORD    xResVid;            // Video stream premonitor x resolution
  145.     WORD    yResVid;            // Video stream premonitor y resolution
  146.     WORD    FrameRate;
  147.     WORD    PixelAspect;
  148. } VIDEO_SYNC;
  149.  
  150. // These sync values are subscripts into a table of VIDEO_SYNC structures.
  151. //    DO NOT CHANGE THEM!
  152.  
  153. #define    SYNC_NTSC    0
  154. #define    SYNC_PAL    1
  155.  
  156.  
  157. //    Macros to manipulate BOX structures. Note that SETBOX and INTERSECTBOX
  158. //    use Windows RECT operations and work on BOX structures because their 
  159. //    elements are equivalent.
  160.  
  161. #define    SETBOX(b, x1, y1, x2, y2)    SetRect((RECT *)b, x1, x2, y1, y2)
  162. #define    COPYBOX(d, s)                memcpy(d, s, sizeof(BOX))
  163. #define    INTERSECTBOX(d, s1, s2)        IntersectRect((RECT *)d, (RECT *)s1,\
  164.                                         (RECT *)s2)
  165.  
  166. //-------------------------------------------------------------------------
  167. //    External function prototypes.
  168. //-------------------------------------------------------------------------
  169.  
  170. #ifndef ACMAIN_NOEXTERNS
  171. extern VOID        UpdateMenus(WORD);
  172. #endif
  173.  
  174. #ifndef ACAVK_NOEXTERNS
  175. extern BOOL        ToggleMonitor(VOID);
  176. extern BOOL        SetDstBox(HWND);
  177. extern BOOL        SetCopyList(HWND *, WORD);
  178. extern WORD        ToState(WORD);
  179. extern BOOL        IsState(WORD);
  180. extern WORD        GetState(VOID);
  181. #endif
  182.  
  183. #ifndef ACRECT_NOEXTERNS
  184. extern VOID        WinRect2AvkBox(RECT *, BOX *, VIEW *);
  185. #endif
  186.  
  187. #ifndef ACCAPT_NOEXTERNS
  188. extern BOOL        OpenAvioFile(char *);
  189. extern BOOL        CloseAvioFile(VOID);
  190. extern BOOL        ToggleCapture(VOID);
  191. extern BOOL        CaptureAvioData(VOID);
  192. #endif
  193.  
  194. #endif        // #ifndef AVKCAPT_H
  195.  
  196.